#pragma once
//============================================================================
// Copyright (C) 2009-2013 Brett R. Jones 
// All Rights Reserved
//
// You may redistribute and/or modify for non commercial and commercial uses 
// provided this copyright notice remains in place and is not modified
//
// This code is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// brettjones1900@gmail.com
// http://www.p2panarchy.com
//============================================================================

#include <VxNetLib/VxSktBaseMgr.h>

class RcSktConnect;

// implements a manager to manage connect sockets
class RcSktConnectMgr : public VxSktBaseMgr
{
public:
	//=== constructor ===//
	RcSktConnectMgr();
	//=== destructor ===//
	virtual ~RcSktConnectMgr();

	//! make a new socket... give derived classes a chance to override
	virtual VxSktBase *		makeNewSkt( void );

	//! handle received data ( derived classes must implement )
	virtual	void			HandleRecieveData( VxSktBase * poSkt ){ return HandleRecieveData( (RcSktBase *)poSkt );};
	//! handle received data 
	virtual	void			HandleRecieveData( RcSktBase * poSkt );


	//! Connect to ip or url and return socket.. if cannot connect return NULL
	virtual RcSktConnect * ConnectTo(	const char * pIpOrUrl,					// remote ip or url 
										U16			 u16Port,					// port to connect to
										int			 iTimeoutMilliSeconds = 1000);	// seconds before connect attempt times out

	//! override delete skt so is not deleted while still processing que from wxWidgets
	//virtual void			DeleteSkt( VxSktBase * poSkt );	// skt to remove
	
	//=== functions that should only be called by derived classes ===//
	//! handle callbacks from sockets
	//virtual	void			DoRecieveCallback( VxSktBase * poSkt );

protected:

	//=== vars ===//
	//std::vector< VxSktBase *>		m_aoSktsToDelete; // list of closed sockets to delete

};

